import request from '@/config/axios'

export interface WeUserVO {
  id: number
  weUserId: string
  weCorpId: string
  deptId: string
  username: string
  password: string
  nickname: string
  gender: number
  email: string
  telephone: string
  avatar: string
  qrCode: string
  status: number
  customerLink: string
  remark: string
  bindStatus: number
}

// 查询企微员工列表
export const getWeUserPage = async (params) => {
  return await request.get({ url: `/wecom/we-user/page`, params })
}

// 查询企微员工详情
export const getWeUser = async (id: number) => {
  return await request.get({ url: `/wecom/we-user/get?id=` + id })
}

// 新增企微员工
export const createWeUser = async (data: WeUserVO) => {
  return await request.post({ url: `/wecom/we-user/create`, data })
}

// 修改企微员工
export const updateWeUser = async (data: WeUserVO) => {
  return await request.put({ url: `/wecom/we-user/update`, data })
}

// 删除企微员工
export const deleteWeUser = async (id: number) => {
  return await request.delete({ url: `/wecom/we-user/delete?id=` + id })
}

// 导出企微员工 Excel
export const exportWeUser = async (params) => {
  return await request.download({ url: `/wecom/we-user/export-excel`, params })
}

// 获取部门树
export const getSimpleDeptList = async () => {
  return await request.get({ url: `/wecom/we-dept/simple-list` })
}

// 同步企微员工
export const syncUser = async () => {
  return await request.post({ url: `/wecom/we-user/sync-user` })
}
// 客户的列表
export const getByCustomerIdList = async (data) => {
  return await request.post({ url: `/wecom/we-customer/get-by-customer-id-list`, data })
}
// 群聊列表
export const getByChatIdList = async (data) => {
  return await request.post({ url: `/wecom/we-chat-group/get-by-chat-id-list`, data })
}
// 新的群聊列表
export const getByChatMsgList = async (params) => {
  return await request.get({ url: `/wecom/we-chat-msg-record/list-by-chat`, params })
}
// 获客链接列表
export const getByLinkIdList = async (data) => {
  return await request.post({ url: `/wecom/acq-link/get-by-link-id-list`, data })
}

// 获取userList
export const getSimpleWeUserList = async (params) => {
  return await request.get({ url: `/wecom/we-user/simple-list`, params })
}
// 获取userList
export const getPageWeUserList = async (params) => {
  return await request.get({ url: `/wecom/we-user/page`, params })
}
// 企业微信快捷登录
export const weComLogin = async (code) => {
  return await request.get({ url: `/wecom/we-user/login?code=${code}` })
}
// 企业微信内部浏览器登录
export const weComLoginInner = async (code) => {
  return await request.get({ url: `/wecom/we-user/login-inner?code=${code}` })
}
// 企业微信快捷登录
export const weComQuickLogin = async (params) => {
  return await request.get({ url: `/wecom/we-user/quick-login`, params })
}
